package com.sac.approval.service.impl;

import com.sac.approval.dao.ApprovalLineDao;
import com.sac.approval.domain.ApprovalLineDO;
import com.sac.approval.service.ApprovalLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;



@Service
public class ApprovalLineServiceImpl implements ApprovalLineService {
	@Autowired
	private ApprovalLineDao approvalLineDao;
	
	@Override
	public int count(Map<String, Object> map){
		return approvalLineDao.count(map);
	}
	
	@Override
	public int save(ApprovalLineDO approvalLine){
		return approvalLineDao.save(approvalLine);
	}
	
	@Override
	public int update(ApprovalLineDO approvalLine){
		return approvalLineDao.update(approvalLine);
	}

	@Override
	@Transactional
	public int batchUpdate(List<ApprovalLineDO> approvalLines) {
		approvalLines.forEach(line -> {
			update(line);
		});
		return approvalLines.size();
	}

	@Override
	public int remove(String appLineId){
		return approvalLineDao.remove(appLineId);
	}
	
	@Override
	public int batchRemove(String[] appLineIds){
		return approvalLineDao.batchRemove(appLineIds);
	}
	
}
